package com.example.administrator.runbook.fragments.community.activity;

import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;

import com.example.administrator.runbook.R;
import com.example.administrator.runbook.fragments.CommonFragment;
import com.example.administrator.runbook.fragments.adapter.FragmentAdapter;
import com.example.administrator.runbook.fragments.community.fragment.HotFragment;
import com.example.administrator.runbook.fragments.community.fragment.MyFragment;
import com.example.administrator.runbook.fragments.community.fragment.TrendsFragment;
import com.flyco.tablayout.SlidingTabLayout;

import java.util.ArrayList;
import java.util.List;

public class TrendsActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_trends);
        SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.tab_layout_trends);
        ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager_trends);
        List<CommonFragment> list = new ArrayList<>();
        list.add(new TrendsFragment());
        list.add(new HotFragment());
        list.add(new MyFragment());
        FragmentAdapter adapter = new FragmentAdapter(
                getSupportFragmentManager(),
                list
        );
        viewPager.setAdapter(adapter);
        slidingTabLayout.setViewPager(viewPager);
    }
}
